﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Xml.Linq;
using BUSINESS_OBJECT;

namespace CRM.admin
{
    public partial class payment : System.Web.UI.Page
    {
        PAYMENTcls pymnt = new PAYMENTcls();
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                DataTable dt = pymnt.GetRecords(-99, "",-99, Convert.ToDateTime("1/1/1800"), false, "and");
                GridView1.DataSource = dt;
                GridView1.DataBind();
            }
        }

        protected void DTNDELETE_Click(object sender, EventArgs e)
        {

        }

        protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "delete")
            {
                DataTable dt = pymnt.GetRecords(Convert.ToInt64(e.CommandArgument),"", -99, Convert.ToDateTime("1-1-1800"), false, "and");
                pymnt.ID = Convert.ToInt64(dt.Rows[0]["ID"].ToString());
                pymnt.COMPANY_NAME = dt.Rows[0]["COMPANY_NAME"].ToString();
                pymnt.PAYMENT = Convert.ToInt64(dt.Rows[0]["PAYMENT"].ToString());
                pymnt.DATE =Convert.ToDateTime(dt.Rows[0]["DATE"].ToString());
                pymnt.ISDELETED = true;
                pymnt.SaveRecords();
                Response.Redirect("payment.aspx");
            }

        }
    }
}
